package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatProject;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 肖守凯
 * @since 2020-08-24
 */
@Controller
@RequestMapping("/WeChatUser/wechatProject")
public class WechatProjectController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "Wechatproject/WechatprojectMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatProjectHtml")
    public String addWechatProjectHtml( ){
             return "Wechatproject/WechatprojectAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatProjectHtml")
    public String editWechatProjectHtml(Integer id ,Model model ){
           model.addAttribute("wechatProject",wechatProjectService.selectWechatProjectByIdWechatProject(id));
             return "Wechatproject/WechatprojectEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatProjectHtml")
    public String showWechatProjectHtml(Integer id ,Model model ){
           model.addAttribute("wechatProject",wechatProjectService.selectWechatProjectByIdWechatProject(id));
             return "Wechatproject/WechatprojectShow";
    }


    /** 分页查询WechatProject
     * @param page  页码
     * @param limit  查几条
     * @param wechatProject  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatProjectByPage")
    @ResponseBody
    public ResultPage findWechatProjectByPage(Integer page, Integer limit,WechatProject wechatProject){
             return wechatProjectService.findWechatProjectByPage(page,limit,wechatProject);
    }

    /** 添加WechatProject
     * @param wechatProject  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatProject")
    @ResponseBody
    public ApiResultModel saveWechatProject(WechatProject wechatProject  ){
             return wechatProjectService.addWechatProject(wechatProject);
    }

    /** 编辑WechatProject
     * @param wechatProject  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatProject")
    @ResponseBody
    public ApiResultModel editWechatProject(WechatProject wechatProject  ){
             return wechatProjectService.editWechatProject(wechatProject);
    }



    /** 删除一条WechatProject
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatProject")
    @ResponseBody
    public ApiResultModel delWechatProject( Integer id  ){
             return wechatProjectService.delWechatProject(id);
    }


}
